
function basicdata(hospitalVisit){
	var inHospitalDateTime=hospitalVisit.inHospitalDateTime;
	var outHospitalDateTime=hospitalVisit.outHospitalDateTime;
	
	var intime=getymd(inHospitalDateTime);
	var outtime=getymd(outHospitalDateTime);
	$("#medicalInsuranceNumber").html(hospitalVisit.medicalInsuranceNumber);
	$("#visitNumber").html(hospitalVisit.visitNumber);
	$("#mrId").html(hospitalVisit.mrId);
	$("#onlyId").html(hospitalVisit.onlyId);
	$("#medicalPayTypeName").html(hospitalVisit.medicalPayTypeName);
	$("#patientName").html(hospitalVisit.patientName);
	$("#sexName").html(hospitalVisit.sexName);
	$("#birthday").html(hospitalVisit.birthday);
	if(hospitalVisit.age){
		$("#age").html(hospitalVisit.age);
	}else{
		if(hospitalVisit.birthday && inHospitalDateTime){
			var tempBirthDay = new Date(Date.parse(hospitalVisit.birthday.replace(/-/g, "/")));
			var tempInhospitalDate = new Date(Date.parse(inHospitalDateTime.replace(/-/g, "/")));
			$("#age").html(tempInhospitalDate.getFullYear()-tempBirthDay.getFullYear());
		}
	}
	
	$("#marriageName").html(hospitalVisit.marriageName);
	$("#professionName").html(hospitalVisit.professionName);
	$("#birthAddress").html(hospitalVisit.birthAddress);
	$("#nationName").html(hospitalVisit.nationName);
	$("#nationalityName").html(hospitalVisit.nationalityName);
	$("#idNumber").html(hospitalVisit.idNumber);
	$("#workUnitName").html(hospitalVisit.workUnitName);
	$("#workUnitAddress").html(hospitalVisit.workUnitAddress);
	$("#workUnitPhone").html(hospitalVisit.workUnitPhone);
	$("#workUnitPostCode").html(hospitalVisit.workUnitPostCode);
	$("#permanentAddress").html(hospitalVisit.permanentAddress);
	$("#permanentAddressPostCode").html(hospitalVisit.permanentAddressPostCode);
	$("#linkManName").html(hospitalVisit.linkManName);
	$("#linkManRelativeRelationName").html(hospitalVisit.linkManRelativeRelationName);
	$("#linkManPhone").html(hospitalVisit.linkManPhone);
	$("#linkManAddress").html(hospitalVisit.linkManAddress);
	$("#inHospitalTypeName").html(hospitalVisit.inHospitalTypeName);
	$("#inHospitalStateName").html(hospitalVisit.inHospitalStateName);
	$("#clinicalReceptionDateTime").html(hospitalVisit.clinicalReceptionDateTime);
	$("#responsiblePersonName").html(hospitalVisit.responsiblePersonName);
	$("#inHospitalDateTime").html(intime);
	$("#inDeptName").html(hospitalVisit.inDeptName);
	$("#outHospitalDateTime").html(outtime);
	$("#outDeptName").html(hospitalVisit.outDeptName);
}
	function getymd(dateStr) {
		if(dateStr=="" || dateStr==undefined){
			return "";
		}
	     var date = new Date(Date.parse(dateStr.replace(/-/g, "/")));
	     var mm = date.getMonth() + 1;
	     //月
	     var dd = date.getDate();
	     //日
	     var yy = date.getFullYear();
	     //年
	     var h = date.getHours(); 
	     return yy+"年"+mm+"月"+dd+"日&nbsp;"+h+"时";
	 } 
	function personnelCategory(hospitalVisit){
		$("#personnelCategoryName").html(hospitalVisit.personnelCategoryName);
		$("#majorUnitName").html(hospitalVisit.majorUnitName);
		$("#troopServiceName").html(hospitalVisit.troopServiceName);
		$("#medicalSystemName").html(hospitalVisit.medicalSystemName);
		$("#idTypeName").html(hospitalVisit.idTypeName);
		$("#costTypeName").html(hospitalVisit.costTypeName);
		$("#jobStateName").html(hospitalVisit.jobStateName);
		$("#militaryTrainingInjuryName").html(hospitalVisit.militaryTrainingInjuryName);
		$("#diagConfirmedDateTime").html(hospitalVisit.diagConfirmedDateTime);
		$("#diagConfirmedDayNumber").html(hospitalVisit.diagConfirmedDayNumber);
		$("#inHospitalDayNumber").html(hospitalVisit.inHospitalDayNumber);
	}
	function cureInfo(data){
		
		
		var bloodTypeCode=data.bloodTypeCode;
		if(bloodTypeCode){
			$("#bloodTypeCode").html(bloodTypeCode);
		}
		
		if(data.rhBloodTypeCode){
			$("#rhBloodTypeCode").html(data.rhBloodTypeCode);
		}
		
		$("#hbsag").html(data.hbsAgeResultCode);
		$("#hcvab").html(data.hcvAbResultCode);
		$("#hivab").html(data.hivAbResultCode);
	}
	function diagAccordRecords(data){
		var diags=data.diagAccordRecords;
		for(var index in diags){
			var diag = diags[index];
			if( diag.diagCompareName.indexOf("门诊") >=0 && diag.diagCompareName.indexOf("出院") >=0){
				if(diag.diagAccordCode){
					$("#accord0").html(diag.diagAccordCode);
				}
				
			}
			if( diag.diagCompareName.indexOf("入院") >=0 &&  diag.diagCompareName.indexOf("出院") >=0){
				if(diag.diagAccordCode){
					$("#accord1").html(diag.diagAccordCode);
				}
			}
			if( diag.diagCompareName.indexOf("术前") >=0 &&  diag.diagCompareName.indexOf("术后") >=0){
				if(diag.diagAccordCode){
					$("#accord2").html(diag.diagAccordCode);
				}
			}
			if( diag.diagCompareName.indexOf("临床") >=0 && diag.diagCompareName.indexOf("病理") >=0){
				if(diag.diagAccordCode){
					$("#accord3").html(diag.diagAccordCode);
				}
			}
			if( diag.diagCompareName.indexOf("放射") >=0 && diag.diagCompareName.indexOf("病理") >=0){
				if(diag.diagAccordCode){
					$("#accord4").html(diag.diagAccordCode);
				}
			}
		
		}
	}
	
	function costRecords(data){
		var costs=data.costRecords;
		var money=0;
		for(var index in costs){
			var cost=costs[index];
			if(cost.medicalCostTypeName.indexOf("床位")>=0){
				$("#costMoney1").html(cost.costMoney);
				money=money+cost.costMoney;
			}
			if(cost.medicalCostTypeName.indexOf("西药")>=0){
				$("#costMoney2").html(cost.costMoney);
				money=money+cost.costMoney;
			}
			if(cost.medicalCostTypeName.indexOf("中药")>=0){
				$("#costMoney3").html(cost.costMoney);
				money=money+cost.costMoney;
			}
			if(cost.medicalCostTypeName.indexOf("检验")>=0){
				$("#costMoney4").html(cost.costMoney);
				money=money+cost.costMoney;
			}
			if(cost.medicalCostTypeName.indexOf("放射")>=0){
				$("#costMoney5").html(cost.costMoney);
				money=money+cost.costMoney;
			}
			if(cost.medicalCostTypeName.indexOf("特检")>=0){
				$("#costMoney6").html(cost.costMoney);
				money=money+cost.costMoney;
			}
			if(cost.medicalCostTypeName.indexOf("治疗")>=0){
				$("#costMoney7").html(cost.costMoney);
				money=money+cost.costMoney;
			}
			if(cost.medicalCostTypeName.indexOf("输血")>=0){
				$("#costMoney8").html(cost.costMoney);
				money=money+cost.costMoney;
			}
			if(cost.medicalCostTypeName.indexOf("手术")>=0){
				$("#costMoney9").html(cost.costMoney);
				money=money+cost.costMoney;
			}
			if(cost.medicalCostTypeName.indexOf("护理")>=0){
				$("#costMoney10").html(cost.costMoney);
				money=money+cost.costMoney;
			}
			if(cost.medicalCostTypeName.indexOf("其他")>=0){
				$("#costMoney11").html(cost.costMoney);
				money=money+cost.costMoney;
			}
		}
			if(money>0){
				$("#costMoney0").html(money);
			}
	}
	
	function infusionBloodInfo(data){
		$("#infusionBloodTimes").html(data.infusionBloodTimes);
		$("#infusionBloodReactTimes").html(data.infusionBloodReactTimes);
	}
	
	function cureWorkers(data){
		var cureWorkers=data.cureWorkers;
		for(var index in cureWorkers){
			var cureWorker=cureWorkers[index];
			if(cureWorker.professionTitleName.indexOf("科主任")>=0){
				$("#cureWorkers0").html(cureWorker.medicalWorkerName);
			}
			if(cureWorker.professionTitleName.indexOf("主(副主)任医师")>=0){
				$("#cureWorkers1").html(cureWorker.medicalWorkerName);
			}
			if(cureWorker.professionTitleName.indexOf("主治医生")>=0){
				$("#cureWorkers2").html(cureWorker.medicalWorkerName);
			}
			if(cureWorker.professionTitleName.indexOf("住院医师")>=0){
				$("#cureWorkers3").html(cureWorker.medicalWorkerName);
			}
			if(cureWorker.professionTitleName.indexOf("进修医师")>=0){
				$("#cureWorkers4").html(cureWorker.medicalWorkerName);
			}
			if(cureWorker.professionTitleName.indexOf("研究生实习医师")>=0){
				$("#cureWorkers5").html(cureWorker.medicalWorkerName);
			}
			if(cureWorker.professionTitleName.indexOf("实习医师")>=0){
				$("#cureWorkers6").html(cureWorker.medicalWorkerName);
			}
			if(cureWorker.professionTitleName.indexOf("编码员")>=0){
				$("#cureWorkers7").html(cureWorker.medicalWorkerName);
			}
			if(cureWorker.professionTitleName.indexOf("质控医师")>=0){
				$("#cureWorkers8").html(cureWorker.medicalWorkerName);
			}
			if(cureWorker.professionTitleName.indexOf("质控护士")>=0){
				$("#cureWorkers9").html(cureWorker.medicalWorkerName);
			}
		}
		
	}
	
	function operateInfo(data){
		var operateRecords=data;
		var html="";
		for(var index in operateRecords){
			var operateRecord=operateRecords[index];
			var operateWorker=operateRecord.operateWorkers[index];
			if(operateRecord.operateStartDate=="" || operateRecord.operateStartDate==null){
				operateRecord.operateStartDate="";
			}
			html=html+"<tr>"+
						"<td style='height: 50px' align='center'>"+
						"<label><span id=''>"+operateRecord.operateStartDate.substring(0,10)+"</span></label>"+
						"</td>"+
						"<td style='height: 50px' align='center'>"+
							"<label><span id=''>"+operateRecord.operateName+"</span></label>"+
						"</td>"+
						"<td style='height: 50px' align='center'>"+
							"<label><span id=''>"+operateRecord.operateWorkers[1].medicalWorkerName+"</span></label>"+
						"</td>"+
						"<td style='height: 50px' align='center'>"+
							"<label><span id=''>"+operateRecord.operateWorkers[2].medicalWorkerName+"</span></label>"+
						"</td>"+
						"<td style='height: 50px' align='center'>"+
							"<label><span id=''>"+operateRecord.operateWorkers[3].medicalWorkerName+"</span></label>"+
						"</td>"+
						"<td style='height: 50px' align='center'>"+
							"<label><span id=''>"+operateRecord.anaesthesiaTypeName+"</span></label>"+
						"</td>"+
						"<td style='height: 50px' align='center'>"+
							"<label><span id=''>"+operateRecord.cicatrizeTypeName+"</span></label>"+
						"</td>"+
						"<td style='height: 50px' align='center'>"+
							"<label><span id=''>"+operateRecord.operateWorkers[0].medicalWorkerName+"</span></label>"+
						"</td>"+
						"<td style='height: 50px' align='center'>"+
							"<label><span id=''>"+operateRecord.operateCode+"</span></label>"+
						"</td>"+
					 "</tr>";
		}
		html = html.replace(new RegExp("null","g"),"");
		$("#operateRecords").html(html);
	}
	
	function diseaseDiagRecords(data){
		var diseaseDiagRecords=data.diseaseDiagRecords;
		var num=0;
		var tbodyHtml="";
		for(var index in diseaseDiagRecords){
			var diseaseDiagRecord=diseaseDiagRecords[index];
			if(diseaseDiagRecord.confirmedDateTime=="" || diseaseDiagRecord.confirmedDateTime==null){
				diseaseDiagRecord.confirmedDateTime="";
			}
			if(diseaseDiagRecord.diagTypeName.indexOf("门诊诊断")>=0){
				$("#diseaseDiagName0").html(diseaseDiagRecord.diseaseDiagName);
				$("#diseaseDiagCode0").html(diseaseDiagRecord.diseaseDiagCode);
			}
			if(diseaseDiagRecord.diagTypeName.indexOf("主要诊断")>=0){
				$("#diseaseDiagName1").html(diseaseDiagRecord.diseaseDiagName);
				$("#confirmedDateTime1").html(diseaseDiagRecord.confirmedDateTime.substring(0,10));
				$("#treatResultName1").html(diseaseDiagRecord.treatResultName);
				$("#treatDayNumber1").html(diseaseDiagRecord.treatDayNumber);
				$("#diseaseDiagCode1").html(diseaseDiagRecord.diseaseDiagCode);
			}
			if(diseaseDiagRecord.diagTypeName.indexOf("入院初")>=0){
				$("#diseaseDiagName2").html(diseaseDiagRecord.diseaseDiagName);
				$("#diseaseDiagCode2").html(diseaseDiagRecord.diseaseDiagCode);
			}
			if(diseaseDiagRecord.diagTypeName.indexOf("次要诊断")>=0){
				if(num == 0){
					tbodyHtml=tbodyHtml+"<tr>"+
						"<td width='510'>"+
							"<label style='width: 320px;'>其他诊断&nbsp;<span id='diseaseDiagName3'>"+diseaseDiagRecord.diseaseDiagName+"</span></label>"+
						"</td>"+
						"<td width='90' align='center'>"+
							"<label style='width: 79px;'><span id='confirmedDateTime3'>"+diseaseDiagRecord.confirmedDateTime.substring(0,10)+"</span></label>"+
						"</td>"+
						"<td width='22'>"+
							"<label style='width: 35px;'><span id='treatResultName3'>"+diseaseDiagRecord.treatResultName+"</span></label>"+
						"</td>"+
						"<td width='22' align='center'>"+
							"<label style='width: 35px;'><span id='treatResultCode3'>"+diseaseDiagRecord.treatDayNumber+"</span></label>"+
						"</td>"+
						"<td width='70' align='center'>"+
							"<label style='width: 60px;'><span id='diseaseDiagCode3'>"+diseaseDiagRecord.diseaseDiagCode+"</span></label>"+
						"</td>"+
					"</tr>";
				}else{
					tbodyHtml=tbodyHtml+"<tr>"+
						"<td>"+
							"<label style='width: 320px;'>&emsp;&emsp;&emsp;&emsp;&nbsp;<span id=''>"+diseaseDiagRecord.diseaseDiagName+"</span></label>"+
						"</td>"+
						"<td align='center'>"+
							"<label style='width: 79px;'><span id=''>"+diseaseDiagRecord.confirmedDateTime.substring(0,10)+"</span></label>"+
						"</td>"+
						"<td>"+
							"<label style='width: 35px;'><span id=''>"+diseaseDiagRecord.treatResultName+"</span></label>"+
						"</td>"+
						"<td align='center'>"+
							"<label style='width: 35px;'><span id=''>"+diseaseDiagRecord.treatDayNumber+"</span></label>"+
						"</td>"+
						"<td align='center'>"+
							"<label style='width: 60px;'><span id=''>"+diseaseDiagRecord.diseaseDiagCode+"</span></label>"+
						"</td>"+
					"</tr>";
				}
				num=num+1;
			}
			if(diseaseDiagRecord.diagTypeName.indexOf("损伤、中毒的外部原因")>=0){
				$("#diseaseDiagName4").html(diseaseDiagRecord.diseaseDiagName);
				$("#diseaseDiagCode4").html(diseaseDiagRecord.diseaseDiagCode);
			}
			if(diseaseDiagRecord.diagTypeName.indexOf("根本死亡原因")>=0){
				$("#diseaseDiagName5").html(diseaseDiagRecord.diseaseDiagName);
				$("#diseaseDiagCode5").html(diseaseDiagRecord.diseaseDiagCode);
			}
		}
		tbodyHtml=tbodyHtml+"<tr>"+
								"<td>"+
									"<label style='width: 320px;'>&emsp;&emsp;&emsp;&emsp;&nbsp;<span id=''></span></label>"+
								"</td>"+
								"<td align='center'>"+
									"<label style='width: 79px;'><span id=''></span></label>"+
								"</td>"+
								"<td>"+
									"<label style='width: 35px;'><span id=''></span></label>"+
								"</td>"+
								"<td align='center'>"+
									"<label style='width: 35px;'><span id=''></span></label>"+
								"</td>"+
								"<td align='center'>"+
									"<label style='width: 60px;'><span id=''></span></label>"+
								"</td>"+
							"</tr>";
		tbodyHtml=tbodyHtml+"<tr>"+
		"<td>"+
			"<label style='width: 320px;'>&emsp;&emsp;&emsp;&emsp;&nbsp;<span id=''></span></label>"+
		"</td>"+
		"<td align='center'>"+
			"<label style='width: 79px;'><span id=''></span></label>"+
		"</td>"+
		"<td>"+
			"<label style='width: 35px;'><span id=''></span></label>"+
		"</td>"+
		"<td align='center'>"+
			"<label style='width: 35px;'><span id=''></span></label>"+
		"</td>"+
		"<td align='center'>"+
			"<label style='width: 60px;'><span id=''></span></label>"+
		"</td>"+
	"</tr>";
		tbodyHtml = tbodyHtml.replace(new RegExp("null","g"),"");
		$("#secondarydiagnosis").html(tbodyHtml);
		
	}
	function addReportsRecord(reportsInfo){
		var reportsRecords=reportsInfo.examinationReportsRecords;
		for(var index in reportsRecords){
			var reportsRecord=reportsRecords[index];
			var add_content=$("#reportsRecordTemplate").clone();
			add_content.removeAttr("id");
			add_content.find(".patientName").html(reportsRecord.patientName);
			add_content.find(".sexName").html(reportsRecord.sexName);
			add_content.find(".ageName").html(reportsRecord.ageName);
			add_content.find(".mrId").html(reportsRecord.mrId);
			add_content.find(".deptCategoryName").html(reportsRecord.deptCategoryName);
			add_content.find(".bedName").html(reportsRecord.bedName);
			add_content.find(".costName").html(reportsRecord.costName);
			add_content.find(".submittingPhysicianName").html(reportsRecord.submittingPhysicianName);
			add_content.find(".specimenCode").html(reportsRecord.specimenCode);
			add_content.find(".barCode").html(reportsRecord.barCode);
			add_content.find(".specimenTypeName").html(reportsRecord.specimenTypeName);
			add_content.find(".clinicalDiagnosisName").html(reportsRecord.clinicalDiagnosisName);
			add_content.find(".samplingDateTime").html(reportsRecord.samplingDateTime);
			add_content.find(".inspectDateTime").html(reportsRecord.inspectDateTime);
			add_content.find(".inspectionDoctorName").html(reportsRecord.inspectionDoctorName);
			add_content.find(".acceptanceCheckDateTime").html(reportsRecord.acceptanceCheckDateTime);
			add_content.find(".reportDateTime").html(reportsRecord.reportDateTime);
			add_content.find(".auditorDoctorName").html(reportsRecord.auditorDoctorName);
			add_content.find(".remark").html(reportsRecord.remark);
			add_content.removeAttr("hidden");
			var reportItems=reportsRecord.examinationReportsItems;
			var reportsRecordTable= add_content.find("#reportsRecordTableTemplate");
		    reportsRecordTable.removeAttr("id");
		    var itemCount=0;
			for(var itemIndex in reportItems){
				var reportItem=reportItems[itemIndex];
				itemCount++;
			    var addItem = reportsRecordTable.find("#reportItemTrTemplate").clone();
			    addItem.removeAttr("id");
			    addItem.removeAttr("hidden");
			    addItem.find(".index").html(itemCount);
			    addItem.find(".projectName").html(reportItem.projectName);
			  addItem.find(".voerFlowremark").html(reportItem.examinationResultMark);
			    addItem.find(".examinationResult").html(reportItem.examinationResult);
			    addItem.find(".examinationUnit").html(reportItem.examinationUnit);
			    addItem.find(".referenceValues").html(reportItem.referenceValues);
			    if(reportItem.examinationResultMark =="H"){
			    	addItem.find(".examinationResultMark").html("↑");
			    }else if(reportItem.examinationResultMark =="L"){
			    	addItem.find(".examinationResultMark").html("↓");
			    }
			   reportsRecordTable.find("tbody").append(addItem);
			}
			
		   
			$("#reportsRecords").append(add_content);
		}
		
	}
	
	//临时医嘱单
	function doctorAdviceTemporaryInfo(data){

		var doctorAdviceTemporaryRecords=data.doctorAdviceTemporaryRecords;
		var num=0;
		var pagesize = 28;
		for(var index in doctorAdviceTemporaryRecords){
			
			
			var doctorAdviceTemporaryRecord=doctorAdviceTemporaryRecords[index];
			var doctorAdviceTemporaryItems=doctorAdviceTemporaryRecord.doctorAdviceTemporaryItems;
			var pageCount = Math.ceil(doctorAdviceTemporaryItems.length/pagesize);
			for(pageIndex =0;pageIndex<pageCount; pageIndex ++){
				num++;
				var doctorAdviceTemporaryModel=$("#doctorAdviceTemporaryModel").clone();
				doctorAdviceTemporaryModel.removeAttr("id");
				doctorAdviceTemporaryModel.removeAttr("hidden");
				doctorAdviceTemporaryModel.find(".patientId").html(doctorAdviceTemporaryRecord.patientId);
				doctorAdviceTemporaryModel.find(".patientName").html(doctorAdviceTemporaryRecord.patientName);
				doctorAdviceTemporaryModel.find(".deptName").html(doctorAdviceTemporaryRecord.deptName);
				doctorAdviceTemporaryModel.find(".bedName").html(doctorAdviceTemporaryRecord.bedName);
				doctorAdviceTemporaryModel.find(".mrId").html(doctorAdviceTemporaryRecord.mrId);
				doctorAdviceTemporaryModel.find(".indexNumber").html(num);
				var doctorAdviceTemporaryTable=doctorAdviceTemporaryModel.find("#doctorAdviceTemporaryTable");
				doctorAdviceTemporaryTable.removeAttr("id");
				for(itemIndex=0;itemIndex<pagesize; itemIndex++){

					var doctorAdviceTemporaryItem=doctorAdviceTemporaryItems[itemIndex+(pagesize*pageIndex)];
					if(doctorAdviceTemporaryItem == null){
						continue;
					}
					var doctorAdviceContent=doctorAdviceTemporaryTable.find("#doctorAdviceContent").clone();
					doctorAdviceContent.removeAttr("hidden");
					doctorAdviceContent.removeAttr("id");
					if(doctorAdviceTemporaryItem.presupposeDateTime){
						doctorAdviceContent.find(".presupposeDateTimeymd").html(doctorAdviceTemporaryItem.presupposeDateTime.substring(2,10));
						doctorAdviceContent.find(".presupposeDateTimehms").html(doctorAdviceTemporaryItem.presupposeDateTime.substring(11,16));
						
					}
					doctorAdviceContent.find(".doctorAdviceContent").html(doctorAdviceTemporaryItem.doctorAdviceContent);
					doctorAdviceContent.find(".doctorName").html(doctorAdviceTemporaryItem.doctorName);
					doctorAdviceContent.find(".nurseName").html(doctorAdviceTemporaryItem.nurseName);
					if(doctorAdviceTemporaryItem.executionDateTime){
						doctorAdviceContent.find(".executionDateTime").html(doctorAdviceTemporaryItem.executionDateTime.substring(11,16));
						
					}
					doctorAdviceTemporaryTable.find("tbody").append(doctorAdviceContent);
				
				}

				$("#doctorAdviceTemporaryInfo").append(doctorAdviceTemporaryModel);
			}
			
		}
	}
	
	//长期医嘱单
	function doctorAdviceStandingInfo(data){
		var doctorAdviceStandingRecords=data.doctorAdviceStandingRecords;
		var num=0;
		var pagesize = 24;
		for(var index in doctorAdviceStandingRecords){
			
			var doctorAdviceStandingRecord=doctorAdviceStandingRecords[index];
			var doctorAdviceStandingItems=doctorAdviceStandingRecord.doctorAdviceStandingItems;
			var pageCount = Math.ceil(doctorAdviceStandingItems.length/pagesize);
			for(pageIndex =0;pageIndex<pageCount; pageIndex ++){
				num++;
				var longTermDoctorListModel=$("#doctorAdviceStandingRecordTemplate").clone();
				longTermDoctorListModel.removeAttr("id");
				longTermDoctorListModel.removeAttr("hidden");
				//基础信息
			
				longTermDoctorListModel.find(".patientName").html(doctorAdviceStandingRecord.patientName);
				longTermDoctorListModel.find(".deptName").html(doctorAdviceStandingRecord.deptName);
				longTermDoctorListModel.find(".bedName").html(doctorAdviceStandingRecord.bedName);
				longTermDoctorListModel.find(".patientId").html(doctorAdviceStandingRecord.patientId);
				longTermDoctorListModel.find(".mrId").html(doctorAdviceStandingRecord.mrId);
				longTermDoctorListModel.find(".indexNumber").html(num);
				//循环医嘱信息
				
				var longTermDoctorListTableModel=longTermDoctorListModel.find("#doctorAdviceStandingRecordTable");
				longTermDoctorListTableModel.removeAttr("id");
				for(itemIndex=0;itemIndex<pagesize; itemIndex++){

					var doctorAdviceStandingItem=doctorAdviceStandingItems[itemIndex+(pagesize*pageIndex)];
					if(doctorAdviceStandingItem == null){
						continue;
					}
					var doctorListContent=longTermDoctorListTableModel.find("#doctorListContent").clone();
					doctorListContent.removeAttr("hidden");
					doctorListContent.removeAttr("id");
					if(doctorAdviceStandingItem.doctorAdviceStartDateTime=="" || doctorAdviceStandingItem.doctorAdviceStartDateTime==null || typeof doctorAdviceStandingItem.doctorAdviceStartDateTime==undefined){
						doctorListContent.find(".doctorAdviceStartDate").html("");
						doctorListContent.find(".doctorAdviceStartTime").html("");
					}else{
						doctorListContent.find(".doctorAdviceStartDate").html(doctorAdviceStandingItem.doctorAdviceStartDateTime.substring(2,10));
						doctorListContent.find(".doctorAdviceStartTime").html(doctorAdviceStandingItem.doctorAdviceStartDateTime.substring(11,16));
					}
					
					doctorListContent.find(".doctorAdviceContent").html(doctorAdviceStandingItem.doctorAdviceContent);
					doctorListContent.find(".doctorAdviceStartDoctorName").html(doctorAdviceStandingItem.doctorAdviceStartDoctorName);
					doctorListContent.find(".doctorAdviceStartNurseName").html(doctorAdviceStandingItem.doctorAdviceStartNurseName);
					if(doctorAdviceStandingItem.doctorAdviceEndDateTime=="" || doctorAdviceStandingItem.doctorAdviceEndDateTime==null || typeof doctorAdviceStandingItem.doctorAdviceEndDateTime==undefined){
						doctorListContent.find(".doctorAdviceEndDate").html("");
						doctorListContent.find(".doctorAdviceEndTime").html("");
					}else{
						doctorListContent.find(".doctorAdviceEndDate").html(doctorAdviceStandingItem.doctorAdviceEndDateTime.substring(5,10));
						doctorListContent.find(".doctorAdviceEndTime").html(doctorAdviceStandingItem.doctorAdviceEndDateTime.substring(11,16));
					}
					
					doctorListContent.find(".doctorAdviceEndDoctorName").html(doctorAdviceStandingItem.doctorAdviceEndDoctorName);
					doctorListContent.find(".doctorAdviceEndNurseName").html(doctorAdviceStandingItem.doctorAdviceEndNurseName);
					longTermDoctorListTableModel.find("tbody").append(doctorListContent);
				
				}
				$("#doctorAdviceStandingInfo").append(longTermDoctorListModel);
			}
			
		}
	}
	
